<?php
namespace Model;
use Fuel\Core\DB;
// Model Reservascrud
   
class ReservasCrud{

    public static function create_reserva($datos){
            $reserva = Reservas::forge($datos);
            
            if ($reserva->save()) {
                return $reserva->reservaId;
            }else
            {
                $errors = array();
                
                foreach($reserva->validation()->$error as $error => $validation){
                    $errors[$error] = $validation->get_messsage();
                }
              return $errors;
            }
            
        }
        
        public static function select_one_reserva($id){
            
            if ($reserva = Usuarios::find_by_pk($id)) {
                return $reserva->to_array();
            }else return false;
            
        }
        
        public static function delete_one_reserva($id){
        $reserva= Usuarios::find_by_pk($id);
        if($reserva){
            $reserva->delete();
        }else            return false;
                
    }
        
    }
?>
